package com.bltec.emergency.controller.mgrController;

import com.alibaba.fastjson.JSON;
import com.bltec.emergency.common.Constant;
import com.bltec.emergency.common.ResponseJson;
import com.bltec.emergency.model.LogInfo;
import com.bltec.emergency.service.mgrService.LogInfoService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/logInfo")
@RequiresRoles(value="superManger")
public class LogInfoController {
    @Resource
    private LogInfoService LogInfoService;

    @RequestMapping("getAllLogInfo")
    public ResponseJson getAllLogInfo(){
        try {
            List<LogInfo> logInfos = LogInfoService.getAllLogInfo();
            return new ResponseJson(Constant.OK, JSON.toJSON(logInfos));
        }catch (Exception e ){
            e.printStackTrace();
            return new ResponseJson(Constant.FAIL,e.getMessage());
        }
    }

}
